package org.http.controller;


import org.http.annotation.AnnotationManger;
import org.http.annotation.ExecutorBean;
import org.http.annotation.Path;

import java.lang.reflect.InvocationTargetException;
import java.util.Map;

/**
 * @author andy
 */
public class TestController {

    public static void main(String[] args) {
        Map<String, ExecutorBean> executorBeanMap = AnnotationManger.getPathMethod("org.http.controller");
        ExecutorBean bean = executorBeanMap.get("/index/index");

        try {
            String res = (String) bean.getMethod().invoke(bean.getObject(),"1");
            System.out.println(res);
            Path annotation = bean.getMethod().getAnnotation(Path.class);
            System.out.println("注解名称：" + annotation.value());
        } catch (IllegalAccessException | InvocationTargetException e) {
            e.printStackTrace();
        }

    }
}
